/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.base.service.taccount;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.base.dao.taccount.TaccountDao;
import com.jeesite.modules.base.entity.taccount.Taccount;
import com.jeesite.modules.sys.utils.UserUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 会计科目Service
 * @author shengbin
 * @version 2021-03-29
 */
@Service
@Transactional(readOnly=true)
public class TaccountService extends CrudService<TaccountDao, Taccount> {
	
	/**
	 * 获取单条数据
	 * @param taccount
	 * @return
	 */
	@Override
	public Taccount get(Taccount taccount) {
		return super.get(taccount);
	}
	
	/**
	 * 查询分页数据
	 * @param taccount 查询条件
	 * @param taccount.page 分页对象
	 * @return
	 */
	@Override
	public Page<Taccount> findPage(Taccount taccount) {
		return super.findPage(taccount);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param taccount
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(Taccount taccount) {
        if (taccount.getIsNewRecord()){
            taccount.setCreateBy(UserUtils.getUser().getUserCode());
            taccount.setUpdateBy(UserUtils.getUser().getUserCode());
        }else {
            taccount.setUpdateBy(UserUtils.getUser().getUserCode());
        }
		super.save(taccount);
	}
	
	/**
	 * 更新状态
	 * @param taccount
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(Taccount taccount) {
		super.updateStatus(taccount);
	}
	
	/**
	 * 删除数据
	 * @param taccount
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(Taccount taccount) {
		super.delete(taccount);
	}
	
}